IMSCAN

ImageMan/VBX Scanner Control

Properties 	Events

Description

The scanner control provides the ability to control scanners and other digital image capturing devices from your Visual Basic application. It can be used with the ImageMan/VBX Image control or by itself. The control has the ability to save images into BMP format, on the clipboard or into ImageMan/VBX image controls. All TWAIN compliant scanners, digital cameras and video capture cards are supported.

Obtaining Technical Support

TWAIN information

About Scanner Control Help


About Property

Description

Returns a string containing the Version of the ImageMan/VBX Scanner control.

Usage

ScanControl.About

Data Type

String


Destination Property

Description

Specifies or Returns a string specifying where the image data resulting from a scan should be stored.

Usage

ScanControl.Destination[= DestName$]

Remarks

The following table lists the values for the Destination property:

Setting	Description

Clipboard	Scanned images will be pasted on the Windows Clipboard in CF_DIB format.

File	Scanned images will be stored in files using the filename specified in the Filename Property.

ImageMan/VBX

Control Name	Scanned images will be sent to the specified ImageMan/VBX control.

The "File" and "Clipboard" options are used primarily when the scanned image data is to be used with other image controls or applications.

Data Type

String


PixelType Property

Description

Specifies or Returns the color format of the image data to be scanned when scanning without the scanner's dialog.

Usage

ScanControl.PixelType[= setting%]

Remarks

The following table lists the value for the PixelType property.

Setting	Description

PIXEL_DEFAULT(-1)	Sets the color format to the device's default format.

PIXEL_BW (0)	Sets the color format to Black and White (1 Bit per pixel.)

PIXEL_GRAY(1)	Sets the color format to Greyscale (8 Bits per pixel.)

PIXEL_RGB(2)	Sets the color format to Color (24 Bits per pixel.)

Data Type

Integer (Enumerated)


MaxPages Property

Description

Specifies or Returns the maximum number of pages to be scanned after setting the ScanCommand property.

Usage

ScanControl.MaxPages[=NoPages%]

Remarks

This property is primarily of use with scanners that equipped with Automatic Document Feeders since it allows the application to specify how many pages should be scanned after setting the ScanCommand property. If using an ADF without the scanner's dialog and less that MaxPages pages exist in the scanner then the control will scan only the number of pages that exist.

If this property is set to a value >1 when scanning using the scanner's dialog, the dialog will not close down until MaxPages number of pages have been scanned or the user selects the Cancel or Done option in the dialog. If the user selects Done or Cancel before MaxPages number of pages have been scanned then the control will send a Scan event with an Event code of SOURCE_CLOSED (2) indicating the user closed the scanner's dialog.

The default value of this property is one.

Data Type

Integer


ScanCommand Property

Description

Specifies that the control should perform the specified scanning operation.

Usage

ScanControl.ScanCommand = {0 | 1 | 2}

Remarks

The following table lists the value for the ScanCommand property.

Setting	Description

SCAN_LIST (0)	Displays a dialog allowing the user to select a scanner for subsequent use.

SCAN_SCAN (1)	Begins a scan operation using the scanner's dialog.

SCAN_DIRECT (2)	Begins a scan operation without the scanner's dialog.

Data Type

Integer(Enumerated)


Scan Control Custom Properties
Scanner Control Custom Properties

About 	AppName 	Brightness

Contrast 	Destination 	Device

ErrCode 	ErrString 	FileName

MaxPages 	PixelType 	Resolution

ScanCommand  ScanBottom 	ScanLeft

ScanRight 	ScanTop 	SourceCount

Sources 	UseADF


Scanner Control Custom Events

Scan


Scan Event

Description

Occurs when the scanner completes an operation and when the scanner dialog is closed.

Syntax

Sub ctlname_Scan (Index As Integer, Event As Integer, Status As Integer, Filename As String)

Remarks

The argument Index uniquely identifies a control if it is in a control array.

The Event argument specifies what action occurred. The possible values are:

Value	Description

SCAN_COMPLETE(1)	Specifies that a scan operation completed. Whether the operation was successful can be determined by looking at the Status argument.

SOURCE_CLOSED(2)	Specified that the user closed the scanner's dialog. The value of the Status argument is undefined.

The Status argument specifies the completion status of a scan operation. The possible return values are:

Value	Description

SCAN_OK(0)	Specifies that the scan completed successfully.

SCAN_BUMMER(1)	Specifies that an unspecified TWAIN error occurred.

SCAN_NOMEM(2)	Specifies that the TWAIN source was unable to allocate sufficient memory.

SCAN_NODS(3)	Specifies that no TWAIN source was specified.

SCAN_BUSY(4)	Specifies that the selected source was Busy.

SCAN_CAPERR(6)	Specifies that a Capability negotiation error occurred.

SCAN_PROTERR(9)	Specifies that a TWAIN protocol error has occurred.

SCAN_BADVAL(10)	Specifies that a bad value was used when configuring the TWAIN source.

SCAN_BADSEQ(11)	Specifies that a message was received by the Source out of sequence.

SCAN_BADSRC(12)	Specifies an unknown destination source.

The Filename argument specifies the name of the file used to store the image when the Destination property is set to "File."


Device Property

Description

Specifies or Returns the name of the TWAIN device device to be used when scanning.

Usage

ScanControl.Device[= DeviceName$]

Remarks

This property should be set to the value of the TWAIN device to be used when scanning. A list of the available TWAIN devices is available from the Sources property. This property can also be set to an empty string to indicate that the default TWAIN device should be used when scanning.

Data Type

String


ScanLeft, ScanTop Properties

Description

Sets or Returns the coordinates of the upper left corner of the scan area.

Usage

ScanControl.ScanLeft[= Left]

ScanControl.ScanTop[= Top]

Remarks

These values along with the ScanRight and ScanBottom properties define a bounding rectangle which defines the area of the image to acquire when scanning. These values should be expressed in inches.

To set the capture area to the device's default set these properties to (-1).

Data Type

Real


ScanRight, ScanBottom Properties

Description

Sets or Returns the coordinates of the bottom right corner of the scan area.

Usage

ScanControl.ScanRight[= Right]

ScanControl.ScanBottom[= Bottom]

Remarks

These values along with the ScanTop and ScanLeft properties define a bounding rectangle which defines the area of the image to acquire when scanning. These values should be expressed in inches.

To set the capture area to the device's default set these properties to (-1).

Data Type

Real


ErrString Property

Error Codes

Description

Returns a string describing the completion status of the last scanner operation.

Usage

ScanControl.ErrString

Remarks

This property returns a string which describes the status of the last scan operation.

Data Type

String


ErrCode Property

Description

Returns the completion code of the last scanner operation.

Usage

ScanControl.ErrCode

Remarks

This is set  to zero if the last operation completed successfully otherwise it's set to an error value.

Data Type

Integer


Sources Property

Description

Returns the names of the TWAIN devices configured on the system.

Usage

ScanControl.Sources

Remarks

This array contains the names of each TWAIN device found on the system and includes SourceCount entries.

Data Type

String (Array)


SourceCount Property

Description

Returns the number of TWAIN devices found on the system.

Usage

ScanControl.SourceCount

Remarks

If this value is zero then no TWAIN devices are available and therefore no scanning can take place.

Data Type

Integer


TWAIN
TWAIN is an industry standard specification for a scanner independent interface.

TWAIN is an acronym for "Toolkit Without An Interesting Name."


AppName Property

Description

Specifies or Returns a string containing the name of the user's application.

Usage

ScanControl.AppName[=ApplicationName$]

Remarks

This property is primarily of use when scanning without the scanner's dialog since some TWAIN devices display a dialog containing the application's name.

Data Type

String


Filename Property

Description

Specifies or Returns a string containing the base filename to use when scanning.

Usage

ScanControl.Filename[=FileName$]

Remarks

This property is used to specify the base name of the file(s) into which the scanned data should be placed when the Destination property is set to "File."

If more than one page is scanned then the number of the page scanned will be appended to the filename specified. The control will generate the filename by replacing any zeros at the  end of the filename with the page number of the current scan. For example, specifying a Filename property of Image000.bmp and scanning 3 pages would result in the following file names: Image000.bmp, Image001.bmp and Image002.bmp.

If the filename doesn't contains any trailing zeros and is already 8 characters long, the control will replace the last 2 characters of the filename with the page count if >1 page is to be scanned. If the filename is less than 8 characters the 2 page count digits will be appended. For example, specifying a Filename property of ImageCap.bmp and scanning 3 pages would result in the following file names: ImageC00.bmp, ImageC01.bmp and ImageC02.bmp.

Data Type

String


Resolution Property

Description

Specifies or Returns the resolution in to use when scanning without the scanner's dialog..

Usage

ScanControl.Resolution[=Res%]

Remarks

This values for this property are specified in dots per inch. If the scanner cannot scan at the resolution specified it will use the closest resolution it can generate.

Data Type

Integer


Error Code List
Scanner Error Codes

Value	Description

SCAN_OK(0) Specifies that the scan completed successfully.

SCAN_BUMMER(1) Specifies that an unspecified TWAIN error occurred.

SCAN_NOMEM(2) Specifies that the TWAIN source was unable to allocate sufficient memory.

SCAN_NODS(3) Specifies that no TWAIN source was specified.

SCAN_BUSY(4) Specifies that the selected source was Busy.

SCAN_CAPERR(6) Specifies that a Capability negotiation error occurred.

SCAN_PROTERR(9) Specifies that a TWAIN protocol error has occurred.

SCAN_BADVAL(10) Specifies that a bad value was used when configuring the TWAIN source.

SCAN_BADSEQ(11) Specifies that a message was received by the Source out of sequence.

SCAN_BADSRC(12) Specifies an unknown destination source.


Technical Support
ImageMan/VBX Technical Support

You may obtain technical support for the ImageMan/VBX controls by Email, Phone, FAX, CompuServe and our own StarMan Bulletin Board system.

Data Techniques, Inc.

300 Pensacola Road

Burnsville, NC 28714

Internet:	support@data-tech.com

Web:	www.data-tech.com

FTP:	ftp.data-tech.com

Tech Support:   704-682-4111	9am to 5pm EST

Fax:	704-682-0025

BBS:	704-682-4356 (28.8 V.34)

Compuserve:	GO DATATECH

To get automatic notifications of updates and other important product information, join the ImageMan Mailing List. Send email to: ImageMan-Request@data-tech.com with the word subscribe in the message body.


TWAIN Information

The TWAIN specification was created by a small, ad hoc group of software and hardware companies in response to specific requests for such a gruop to author a proposed specification for the imaging industry. This working group was chartered to provide an open, multi-platform solution to solve the problem of interconnecting  raster input devices with application software.

The TWAIN specification allows applications written to it to work with any TWAIN compatible image acquisition device and conversly any compliant scanner, digital camera or video capture card to work with any TWAIN compliant application.


UseADF Property

Description

Specifies if the control should use the Automatic Document Feeder on a scanner.

Usage

ScanControl.UseADF[=TRUE | FALSE]

Remarks

If this property is set to TRUE then paper will be fed from the Scanner's ADF if it has one.

Data Type

Integer (Boolean)


Brightness Property

Description

Specifies or Returns the brightness to be used when scanning.

Usage

ScanControl.Brightness[=Brightness%]

Remarks

The Brightness property can be set to a range of -1000 to 1000. A setting of zero will use the device's default contrast.

The default value of this property is zero.

Data Type

Integer


Contrast Property

Description

Specifies or Returns the Contrast to be used when scanning.

Usage

ScanControl.Contrast[=Contrast%]

Remarks

The Contrast property can be set to a range of -1000 to 1000. A setting of zero will use the device's default contrast.

The default value of this property is zero.

Data Type

Integer


About Scanner Help
ImageMan/VBX

Scanner Control

Online Help

Version 5.00

1 June 1996